We create an ADM2-year panel to study the effect of climate aid arrival on pollution outcomes from EDGAR. Treatment is defined as first year a climate project occurs in an ADM2 (staggered adoption). Outcome is the ADM2-area-weighted pollution mean.
yvar <-if ("pollution_CO2_log"%in%names(base_panel)) "pollution_CO2_log"else"pollution_CO2_w"run_csdid <-function(base_panel, adopt_tbl, label, min_e =-10, max_e =20) { P <-merge(base_panel[, .(adm2_id, year, y =get(yvar))], adopt_tbl, by ="adm2_id", all.x =TRUE)# Treated flags & event time P[, treated :=as.integer(!is.na(g) & year >= g)] P[, rel_time :=ifelse(is.na(g), NA_integer_, year - g)] P[, adm2_id_int :=as.integer(factor(adm2_id))]# Drop missing outcome and units treated in first overall year min_year <-min(P$year, na.rm =TRUE) D <- P[!is.na(y) & (is.na(g) | g > min_year)]if (nrow(D[!is.na(g)]) ==0L) {warning(sprintf("No treated units for %s — skipping.", label))return(NULL) } att <- did::att_gt(yname ="y",tname ="year",idname ="adm2_id_int",gname ="g",data = D,panel =TRUE, # repeated cross-sections at ADM2-yearcontrol_group ="notyettreated",allow_unbalanced_panel =TRUE )list(label = label,att = att,es = did::aggte(att, type ="dynamic", min_e = min_e, max_e = max_e),grp = did::aggte(att, type ="group") )}
4 CS DiD
We identify the first year in which an ADM2 receives at least one climate project. If the GODAD file already has an ADM2 code, we use it; if not, we perform a spatial join using the point geometry.
# SAFE overall row from a result objectsumm_line_overall <-function(res, use_fallback =TRUE) {if (is.null(res) ||is.null(res$grp)) return(NULL)# Prefer group overall directly without calling summary() (avoids noisy prints) att <-tryCatch(res$grp$overall.att, error =function(e) NA_real_) se <-tryCatch(res$grp$overall.se, error =function(e) NA_real_)if (length(att) ==1L &&is.finite(att) &&length(se) ==1L &&is.finite(se)) {return(data.frame(label = res$label, att = att, se = se)) }# Optional fallback: inverse-variance weighted mean of post dynamic ATTsif (use_fallback &&!is.null(res$es) &&length(res$es$att.egt)) { df <-data.frame(att = res$es$att.egt, se = res$es$se.egt, e = res$es$egt) df <- df[is.finite(df$att) &is.finite(df$se) & df$e >=0, ]if (nrow(df) >=1&&all(df$se >0)) { w <-1/ (df$se^2) att <-sum(w * df$att) /sum(w) se <-sqrt(1/sum(w))return(data.frame(label = res$label, att = att, se = se)) } }# Nothing usable for this specNULL}summ_all <- dplyr::bind_rows(summ_line_overall(res_adapt), summ_line_overall(res_mitig),summ_line_overall(res_clim), summ_line_overall(res_noncl)) |> dplyr::mutate(pct =bt(att),lo =bt(att, se)["lo"], hi =bt(att, se)["hi"] )gt::gt(summ_all) |> gt::fmt_number(columns =c(pct, lo, hi), decimals =1) |> gt::cols_label(pct="ATT (%)", lo="95% lo", hi="95% hi") |> gt::tab_caption("Overall ATT (group aggregated), back-transformed to %.")
Overall ATT (group aggregated), back-transformed to %.
label
att
se
ATT (%)
95% lo
95% hi
Adaptation
-0.007793955
0.009752258
−0.8
NA
NA
Mitigation
-0.001203225
0.015000690
−0.1
NA
NA
All climate
-0.088767206
0.065429463
−8.5
NA
NA
Non-climate
0.014032414
0.011198641
1.4
NA
NA
5.1 Intensity
Show code
suppressPackageStartupMessages({library(data.table); library(ggplot2); library(did)})setDT(godad); setDT(base_panel)# Prefer per-location split columns if already computed in `godad`amt_cols_priority <-c("disb_loc_evensplit", "comm_loc_evensplit","disb_amount", "commit_amount", "amount")amount_col_godad <- amt_cols_priority[amt_cols_priority %in%names(godad)][1]stopifnot(length(amount_col_godad) ==1)message("Using amount column from godad: ", amount_col_godad)# Sanity: we need ADM2 id and YEAR in godad; if year is a date, coerce to integerif (!"year"%in%names(godad)) {stop("`godad` must have a `year` column (integer).")}if (!"adm2_id"%in%names(godad)) {stop("`godad` must carry `adm2_id` (or do the spatial join before this step).")}# Helper to build ADM2-year totals for a filteradm2yr_sum <-function(gd, keep_expr) { x <- gd[eval(keep_expr), .(amt =sum(get(amount_col_godad), na.rm =TRUE)), by = .(adm2_id, year)]setnames(x, "amt", "dose_amt") x[]}# Category filters (adjust if your flags differ)gd <-copy(godad)has_cols <-names(gd)req_flags <-c("is_adaptation","is_mitigation","is_climate")if (!all(req_flags %in% has_cols)) {stop("godad must have logical flags: is_adaptation, is_mitigation, is_climate.")}adm2yr_adapt <-adm2yr_sum(gd, quote(is_adaptation ==TRUE))adm2yr_mitig <-adm2yr_sum(gd, quote(is_mitigation ==TRUE))adm2yr_climate <-adm2yr_sum(gd, quote(is_climate ==TRUE))adm2yr_nonclimate <-adm2yr_sum(gd, quote(is_climate ==FALSE))# Generic merge + first adoption helperattach_dose_and_adopt <-function(bp, adm2yr) { dt <- adm2yr[bp, on =c("adm2_id","year")] dt[is.na(dose_amt), dose_amt :=0] # zero when no project that year# First year with positive amount is the adoption g gtab <- dt[dose_amt >0, .(g =min(year)), by = adm2_id] dt <- gtab[dt, on ="adm2_id"] dt[]}bp_adapt <-attach_dose_and_adopt(base_panel, adm2yr_adapt)bp_mitig <-attach_dose_and_adopt(base_panel, adm2yr_mitig)bp_climate <-attach_dose_and_adopt(base_panel, adm2yr_climate)bp_nonclimate <-attach_dose_and_adopt(base_panel, adm2yr_nonclimate)post_totals_and_bins <-function(dt, n_bins =4) { d <-copy(dt)setorder(d, adm2_id, year)# cumulative dose (for convenience) d[, dose_cum :=cumsum(dose_amt), by = adm2_id]# total post-treatment dose per unit (from g onward) posttab <- d[!is.na(g), .(post_total =max(dose_cum[year >= g[1L]], na.rm =TRUE)), by = adm2_id] d <- posttab[d, on ="adm2_id"]# Cut bins on treated units only treated <- d[!is.na(g), unique(adm2_id)] x <- d[adm2_id %in% treated, post_total]# robust breaks mk_breaks <-function(x, n_bins =4) {if (length(unique(na.omit(x))) < n_bins) x <- x +rnorm(length(x), sd =sd(x, na.rm=TRUE)*1e-8) b <-quantile(x, probs =seq(0,1,length.out = n_bins+1), na.rm =TRUE, type =1) |>unique() |>sort()if (length(b) <=2) b <-quantile(x, probs =c(0,.5,1), na.rm =TRUE, type =1) |>unique() |>sort() b } brks <-mk_breaks(x, n_bins) d[, post_bin :=cut(post_total, breaks = brks, include.lowest =TRUE, right =TRUE)] d[, post_bin :=droplevels(post_bin)] d[]}bp_adapt <-post_totals_and_bins(bp_adapt, n_bins =4)bp_mitig <-post_totals_and_bins(bp_mitig, n_bins =4)bp_climate <-post_totals_and_bins(bp_climate, n_bins =4)bp_nonclimate <-post_totals_and_bins(bp_nonclimate, n_bins =4)
Pre-treatment exposure per ADM2 (constant over time)
Show code
yvar <-"pollution_CO2_log"; stopifnot(yvar %in%names(base_panel))suppressPackageStartupMessages({ library(data.table); library(did) })check_and_fix_postdose <-function(dtf, yvar) { d <-as.data.table(copy(dtf))# 1) Outcome present?if (!yvar %in%names(d)) stop("Outcome column `", yvar, "` not found in data.")# 2) Year must be integerif (!is.integer(d$year)) { d[, year :=as.integer(year)]if (anyNA(d$year)) stop("`year` coercion produced NAs — check your year values.") }# 3) ID should be numeric for did stabilityif (!is.numeric(d$adm2_id)) { d[, adm2_id_int :=as.integer(factor(adm2_id))] } else {setnames(d, "adm2_id", "adm2_id_int") }# 4) Event-time origin g (first treat year) must exist for treatedif (!"g"%in%names(d)) stop("`g` (first treatment year) is missing.")if (all(is.na(d$g))) warning("All g are NA — this category may have no treated units.")# 5) post_bin must exist and have levels with treated obsif (!"post_bin"%in%names(d)) stop("`post_bin` is missing. Run the bin construction step first.") d[, post_bin :=droplevels(post_bin)]if (nlevels(d$post_bin) ==0L) stop("All `post_bin` are NA — no treated ADM2s or post_total is missing.")# Keep only bins that actually contain treated units has_tr <- d[, any(!is.na(g)), by = post_bin] valid_bins <- has_tr[ V1 ==TRUE, post_bin ] d <- d[post_bin %in% valid_bins] d[, post_bin :=droplevels(post_bin)]# 6) Drop rows with missing outcome d <- d[!is.na(get(yvar))]# 7) Basic summary to the consoleprint(d[, .(n_rows=.N,n_adm2=uniqueN(adm2_id_int),n_treated=uniqueN(adm2_id_int[!is.na(g)]),bins=nlevels(post_bin))])print(d[, .(n_adm2=uniqueN(adm2_id_int),n_treated=uniqueN(adm2_id_int[!is.na(g)])),by=post_bin][order(post_bin)])return(d[])}# Wrapper to run CS-DiD with the numeric id we just ensuredrun_postdose_csdid_safe <-function(dtf, label, yvar, min_e=-10, max_e=20) { dd <-check_and_fix_postdose(dtf, yvar) out_es <-vector("list", length(levels(dd$post_bin)))names(out_es) <-levels(dd$post_bin)for (b inlevels(dd$post_bin)) { sub <- dd[post_bin == b]if (sub[!is.na(g), .N] ==0L) next att <- did::att_gt(yname = yvar,tname ="year",idname ="adm2_id_int", # <- numeric idgname ="g",data = sub,panel =TRUE,control_group ="notyettreated",bstrap =TRUE,clustervars ="adm2_id_int" ) es <- did::aggte(att, type ="dynamic", min_e = min_e, max_e = max_e, na.rm = T) out_es[[b]] <- es } es_df <- data.table::rbindlist(lapply(names(out_es), function(b){ x <- out_es[[b]]; if (is.null(x)) return(NULL)data.table(bin=b, e=x$egt, att=x$att.egt, se=x$se.egt) }), use.names=TRUE, fill=TRUE) bin_order <- dd[, .(ord =median(post_total, na.rm =TRUE)), by = post_bin][order(ord), as.character(post_bin)] es_df[, bin :=factor(bin, levels = bin_order, ordered =TRUE)] # <<< dd[, post_bin :=factor(post_bin, levels = bin_order, ordered =TRUE)] # <<< (keeps summaries consistent)if (nrow(es_df)) {library(ggplot2)print(ggplot(es_df, aes(e, att, ymin=att-1.96*se, ymax=att+1.96*se)) +geom_hline(yintercept=0, linetype=2) +geom_ribbon(alpha=.15) +geom_line() +facet_wrap(~ bin, scales="free_y") +labs(x="Event time (years since first project)",y="ATT on outcome",title=paste("CS-DiD dynamics by post-treatment dose —", label)) +theme_minimal() ) }invisible(list(es=out_es, df=es_df))}# Run all four familiesres_adapt <-run_postdose_csdid_safe(bp_adapt, "Adaptation", yvar)
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, :
Dropped 1 units that were already treated in the first period.
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, : Be aware that there are some small groups in your dataset.
Check groups: 2001,2002,2003,2006,2008,2009,2021.
Warning in compute.att_gt(dp): overlap condition violated for 2001 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2001 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2002 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2002 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2003 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2003 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2006 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2006 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2008 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2008 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2009 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2009 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2010 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2010 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2011 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2011 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2012 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2012 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2013 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2013 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2014 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2014 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2015 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2015 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2016 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2016 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2017 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2017 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2018 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2018 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2019 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2019 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2021 to run specified regression
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, : Be aware that there are some small groups in your dataset.
Check groups: 2001,2002,2003,2005,2006,2007,2008,2009.
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, :
Dropped 28 units that were already treated in the first period.
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, : Be aware that there are some small groups in your dataset.
Check groups: 2002,2004,2006,2007,2008,2009.
Warning in compute.att_gt(dp): overlap condition violated for 2001 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2001 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2002 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2002 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2003 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2003 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2004 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2004 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2005 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2005 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2006 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2006 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2007 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2007 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2008 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2008 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2009 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2009 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2010 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2010 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2011 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2011 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2012 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2012 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2013 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2013 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2014 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2014 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2015 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2015 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2016 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2016 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2017 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2017 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2018 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2018 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2019 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2019 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2019
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2019 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2020 to run specified regression
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, :
Dropped 11 units that were already treated in the first period.
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, : Be aware that there are some small groups in your dataset.
Check groups: 2004,2008,2009,2020.
Warning in compute.att_gt(dp): overlap condition violated for 2001 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2001 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2003 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2003 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2004 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2004 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2005 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2005 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2006 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2006 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2007 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2007 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2008 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2008 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2009 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2009 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2010 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2010 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2011 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2011 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2012 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2012 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2013 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2013 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2014 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2014 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2015 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2015 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2016 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2016 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2017 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2017 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2018 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2018 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2019 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2019 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2019
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2019 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2020 to run specified regression
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, : Be aware that there are some small groups in your dataset.
Check groups: 2002,2007,2011.
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, : Not returning pre-test Wald statistic due to singular covariance matrix
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, : Be aware that there are some small groups in your dataset.
Check groups: 2001,2002,2003,2004,2007,2009,2021.
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Simultaneous critical value is arguably `too large' to be realible. This
usually happens when number of observations per group is small and/or there is
no much variation in outcomes.
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, : Be aware that there are some small groups in your dataset.
Check groups: 2004,2007,2020,2021.
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Simultaneous critical value is arguably `too large' to be realible. This
usually happens when number of observations per group is small and/or there is
no much variation in outcomes.
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, :
Dropped 7 units that were already treated in the first period.
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, : Be aware that there are some small groups in your dataset.
Check groups: 2001,2003,2016,2019,2020.
Warning in compute.att_gt(dp): overlap condition violated for 2001 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2001 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2002 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2002 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2003 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2003 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2004 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2004 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2005 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2005 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2006 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2006 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2007 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2007 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2008 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2008 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2009 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2009 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2010 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2010 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2011 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2011 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2012 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2012 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2013 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2013 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2014 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2014 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2015 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2015 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2016 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2016 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2017 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2017 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2018 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2018 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2019 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2019 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2019
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2019 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2020 to run specified regression
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Show code
res_climate <-run_postdose_csdid_safe(bp_climate[!grepl("CHN", adm2_id), ], "All climate", yvar)
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, : Be aware that there are some small groups in your dataset.
Check groups: 2001,2002,2003,2004.
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, :
Dropped 8 units that were already treated in the first period.
Warning in compute.att_gt(dp): overlap condition violated for 2001 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2001 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2002 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2002 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2003 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2003 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2004 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2004 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2005 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2005 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2006 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2006 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2007 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2007 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2008 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2008 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2009 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2009 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2010 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2010 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2011 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2011 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2012 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2012 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2013 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2013 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2014 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2014 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2015 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2015 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2016 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2016 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2017 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2017 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2018 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2018 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2019 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2019 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2021 to run specified regression
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, :
Dropped 35 units that were already treated in the first period.
Warning in compute.att_gt(dp): overlap condition violated for 2001 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2001 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2002 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2002 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2003 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2003 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2004 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2004 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2005 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2005 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2006 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2006 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2007 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2007 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2008 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2008 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2009 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2009 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2010 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2010 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2011 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2011 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2012 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2012 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2013 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2013 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2014 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2014 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2015 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2015 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2016 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2016 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2017 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2017 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2018 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2018 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2019 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2019 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2021 to run specified regression
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, :
Dropped 25 units that were already treated in the first period.
Warning in compute.att_gt(dp): overlap condition violated for 2001 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2001 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2002 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2002 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2003 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2003 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2004 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2004 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2005 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2005 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2006 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2006 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2007 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2007 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2008 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2008 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2009 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2009 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2010 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2010 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2011 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2011 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2012 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2012 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2013 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2013 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2014 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2014 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2015 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2015 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2016 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2016 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2017 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2017 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2018 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2018 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2019 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2019 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2019
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2019 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2021 to run specified regression
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, :
Dropped 98 units that were already treated in the first period.
Warning in compute.att_gt(dp): overlap condition violated for 2001 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2001 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2002 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2002 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2003 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2003 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2004 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2004 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2005 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2005 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2006 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2006 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2007 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2007 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2008 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2008 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2009 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2009 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2010 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2010 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2011 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2011 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2012 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2012 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2013 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2013 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2014 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2014 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2015 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2015 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2016 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2016 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2017 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2017 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2018 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2018 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2019 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2019 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2021 to run specified regression
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, :
Dropped 210 units that were already treated in the first period.
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2001 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2001 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2002 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2002 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2003 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2003 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2004 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2004 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2005 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2005 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2006 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2006 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2007 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2007 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2008 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2008 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2009 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2009 in time
period 2021 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2010 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2010 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2011 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2011 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2012 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2012 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2013 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2013 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2014 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2014 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2015 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2015 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2016 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2016 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2017 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2017 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2018 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2018 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2019 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2019 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2021 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2021 in time
period 2021
Warning in compute.att_gt(dp): Not enough control units for group 2021 in time
period 2021 to run specified regression
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, :
Dropped 407 units that were already treated in the first period.
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2001 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2001 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2002 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2002 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2003 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2003 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2004 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2004 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2005 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2005 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2006 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2006 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2007 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2007 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2008 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2008 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2009 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2009 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2010 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2010 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2011 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2011 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2012 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2012 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2013 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2013 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2014 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2014 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2015 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2015 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2016 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2016 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2017 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2017 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2018 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2018 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2019 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2019 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2019
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2019 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2020 to run specified regression
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, :
Dropped 764 units that were already treated in the first period.
Warning in pre_process_did(yname = yname, tname = tname, idname = idname, : Be aware that there are some small groups in your dataset.
Check groups: 2017,2018,2019,2020.
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2001 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2001 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2002 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2002 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2003 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2003 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2004 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2004 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2005 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2005 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2006 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2006 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2007 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2007 in time
period 2020 to run specified regression
Warning: glm.fit: algorithm did not converge
Warning in compute.att_gt(dp): overlap condition violated for 2008 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2008 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2009 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2009 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2010 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2010 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2011 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2011 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2012 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2012 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2013 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2013 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2014 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2014 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2015 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2015 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2016 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2016 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2017 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2017 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2018 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2018 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2019 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2019 in time
period 2020 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2019
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2019 to run specified regression
Warning in compute.att_gt(dp): overlap condition violated for 2020 in time
period 2020
Warning in compute.att_gt(dp): Not enough control units for group 2020 in time
period 2020 to run specified regression
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Not returning pre-test Wald statistic due to singular covariance matrix
Warning in did::att_gt(yname = yvar, tname = "year", idname = "adm2_id_int", :
Simultaneous critical value is arguably `too large' to be realible. This
usually happens when number of observations per group is small and/or there is
no much variation in outcomes.
Show code
# Build a descriptive-sample panel using "All climate" adoption (change if desired)descP <-merge( base_panel[, .(adm2_id, year, pollution_CO2, pollution_CO2_log)], adopt_climate, by ="adm2_id", all.x =TRUE)descP[, treated :=as.integer(!is.na(g) & year >= g)]descP[, ever_treated :=as.integer(!is.na(g))]# Helper: nice quantile summaryq_summ <-function(x) {c(N =sum(!is.na(x)),mean =mean(x, na.rm =TRUE),sd =sd(x, na.rm =TRUE),p10 =quantile(x, .10, na.rm =TRUE),p50 =quantile(x, .50, na.rm =TRUE),p90 =quantile(x, .90, na.rm =TRUE))}
5.3.1 Sample overview (counts, years, treated share)
library(ggplot2)# Cohort histogram (first g per ADM2)cohort_sizes <- adopt_climate[!is.na(g), .N, by = g][order(g)]cohort_sizes%>%filter(g>=2000)%>%ggplot(aes(g, N)) +geom_col() +labs(title ="Cohort size by first treatment year (All climate)",x ="First project year (g)", y ="ADM2 count") +theme_classic(base_size =12)
Show code
# Cumulative treated share over time# Cumulative treated share = fraction of ADM2 whose g <= yearshare_treated <- descP[!is.na(g), .(share =mean(g <= year)), by = year]# Also include never-treated in denominatorall_ids <-unique(descP$adm2_id)total_n <-length(all_ids)share_treated <- descP[, .(share =mean(!is.na(g) & g <= year)), by = year]ggplot(share_treated, aes(year, share)) +geom_line() +geom_point() +scale_y_continuous(labels = scales::percent) +labs(title ="Share of ADM2 ever treated (cumulative)",x =NULL, y =NULL) +theme_classic(base_size =12)
5.3.4 Outcome distributions & time trends
Show code
# Density of log outcome overallggplot(descP[!is.na(pollution_CO2_log)], aes(pollution_CO2_log)) +geom_density() +labs(title ="Distribution of log(1+CO₂) across ADM2-years",x ="pollution_CO2_log", y ="Density") +theme_classic(base_size =12)
Show code
# Density by ever-treated statusggplot(descP[!is.na(pollution_CO2_log)],aes(pollution_CO2_log, fill =factor(ever_treated))) +geom_density(alpha =0.35) +scale_fill_discrete(name ="Ever treated") +labs(title ="Distribution of log(1+CO₂) by ever-treated status",x ="pollution_CO2_log", y ="Density") +theme_classic(base_size =12)
Show code
# Mean log outcome over time by ever-treated statusmean_by_year <- descP[!is.na(pollution_CO2_log), .(y =mean(pollution_CO2_log, na.rm =TRUE)), by = .(year, ever_treated)]ggplot(mean_by_year, aes(year, y, color =factor(ever_treated))) +geom_line() +geom_point(size =0.9) +labs(title ="Mean log(1+CO₂) over time",color ="Ever treated", x =NULL, y ="Mean log(1+CO₂)") +theme_classic(base_size =12)
5.3.5 Raw event-time mean (not causal; descriptive)
5.3.6 Top emitters (ADM2) — average over the sample window
Show code
# Extract ISO3 from GADM code pattern like "CHN.10.9_1"descP[, iso3 :=sub("\\..*$", "", adm2_id)]top_adm2 <- descP[, .(avg_CO2 =mean(pollution_CO2, na.rm =TRUE)), by = .(iso3, adm2_id)][order(-avg_CO2)][1:20]top_adm2[]
6 Choropleth map of total post-treatment amounts per ADM2
Show code
library(sf)library(ggplot2)library(scales)adm2$adm2_id <- adm2$GID_2map_df <- adm2 |>merge(bp_adapt[, .(post_total =max(post_total, na.rm =TRUE)), by = adm2_id],by ="adm2_id", all.x =TRUE)world_bg <- rnaturalearth::ne_countries(scale ="medium", returnclass ="sf") |>st_transform(st_crs(map_df)) # make sure CRS matches your ADM2 layerggplot() +# Grey background countriesgeom_sf(data = world_bg, fill ="grey90", color ="white", size =0.1) +# Your ADM2 layergeom_sf(data = map_df, aes(fill = post_total), color =NA) +scale_fill_viridis_c(option ="C",trans ="log",labels =label_number(scale_cut =cut_si("unit")),na.value ="grey90",name ="Total\n(Climate Finance)" ) +labs(title ="Where is post-treatment Climate finance concentrated?",subtitle ="ADM2-level total amounts, log scale. Light grey = no projects.",caption ="Source: GODAD; Author's calculations." ) +theme_minimal(base_size =11) +theme(panel.grid.major =element_blank(),panel.grid.minor =element_blank(),legend.position ="right",plot.title =element_text(face ="bold"),plot.subtitle =element_text(size =9) )
Total post-treatment adaptation amounts by ADM2
7 Waffle chart: Share of total amount by bin
Show code
library(waffle)library(dplyr)library(stringr)library(RColorBrewer)# 1️⃣ Aggregate total amounts by dose binbin_amounts <- bp_adapt[!is.na(post_bin), .(total_amt =sum(dose_amt, na.rm =TRUE)), by = post_bin] %>%mutate(post_bin =as.character(post_bin))# 2️⃣ Extract numeric lower bound from bin labels for orderingget_lower <-function(x) {as.numeric(str_extract(x, "[-+]?[0-9]*\\.?[0-9]+(?:e[+-]?\\d+)?"))}bin_amounts <- bin_amounts %>%mutate(lower_bound =get_lower(post_bin)) %>%arrange(lower_bound)# 3️⃣ Convert to millions and build named vector in the **sorted order**parts <-round(bin_amounts$total_amt /1e7) # 1 square = 10Mnames(parts) <- bin_amounts$post_bin# 4️⃣ Define number of bins explicitlyn_bins <-length(parts)# 5️⃣ Pick a nice palette with the right length# Paired works well up to 12; or use viridis(n_bins)pal <-brewer.pal(n_bins, "Paired") # or "PuBuGn", "YlOrRd", "Set2"...bin_levels <-names(parts) # order from lowest to highest binwaffle_df <-tibble(part =factor(rep(bin_levels, times = parts), levels = bin_levels)) %>%mutate(index =row_number(),y = (index -1) %/%20, # number of rowsx = (index -1) %%20 )# Reverse y so origin is bottom-leftwaffle_df$y <-max(waffle_df$y) - waffle_df$y# --- Plot ---ggplot(waffle_df, aes(x, y, fill = part)) +geom_tile(color ="white", size =0.25) +coord_equal() +scale_fill_manual(values = pal, name ="Dose bin") +labs(title ="Share of total adaptation amount by dose bin",subtitle ="Each square represents approximately 10 million USD.\nColors represent bins of post-treatment finance intensity (lower → higher).",x =NULL, y =NULL,caption ="Source: GODAD; Author's calculations." ) +theme_minimal(base_size =12) +theme(axis.text =element_blank(),axis.ticks =element_blank(),panel.grid =element_blank(),legend.position ="right",plot.title =element_text(face ="bold"),plot.subtitle =element_text(size =10),plot.caption =element_text(size =8, hjust =0) )
Share of total adaptation amount by dose bin (1 square = ~1M)